package com.maven.zh.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DataUtil {

private static  DataUtil instance=null;
	
	public static DataUtil getInstance(){
		if(instance==null){
			instance = new DataUtil();
		}
		return instance;
	}
	
	public long getTime(String user_time) {
		long re_time = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		Date d;
		try {
			d = sdf.parse(user_time);
			long l = d.getTime();
			re_time = l;

		} catch (ParseException e) {
			
			e.printStackTrace();
		}
		return re_time;
	}

	public long getTime2(String user_time) {
		long re_time = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date d;
		try {
			d = sdf.parse(user_time);
			long l = d.getTime();
			re_time = l;

		} catch (ParseException e) {
			
			e.printStackTrace();
		}
		return re_time;
	}
	public long getTime3(String user_time) {
		long re_time = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Date d;
		try {
			d = sdf.parse(user_time);
			long l = d.getTime();
			re_time = l;

		} catch (ParseException e) {
			
			e.printStackTrace();
		}
		return re_time;
	}
	public long getTime4(String user_time) {
		long re_time = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		Date d;
		try {
			d = sdf.parse(user_time);
			long l = d.getTime();
			re_time = l;

		} catch (ParseException e) {
			
			e.printStackTrace();
		}
		return re_time;
	}
	public long getTime5(String user_time) {
		long re_time = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
		Date d;
		try {
			d = sdf.parse(user_time);
			long l = d.getTime();
			re_time = l;

		} catch (ParseException e) {
			
			e.printStackTrace();
		}
		return re_time;
	}

}
